import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;
import java.util.concurrent.atomic.AtomicBoolean;

/**
 * Created whit IntelliJ IDEA.
 * Description：
 * User：ZHONGCHEN
 * Date:2022-12-07
 * Time:21:00
 */
class TreeNode {
    int val = 0;
    TreeNode left = null;
    TreeNode right = null;

    public TreeNode(int val) {
        this.val = val;
    }
}

public class Demo {
    //先中序遍历二叉搜索树
    //找到乱序的节点
    static ArrayList<Integer> list = new ArrayList<>();

    public static void main1(String[] args) {
        TreeNode treeNode = new TreeNode(1);
        TreeNode treeNode1 = new TreeNode(2);
        TreeNode treeNode2 = new TreeNode(3);
        treeNode.left = treeNode1;
        treeNode.right = treeNode2;
        System.out.println(Arrays.toString(findError(treeNode)));

    }

    public static int[] findError(TreeNode root) {
        // write code here
        InorderTraversal(root);
        int length = list.size();
        int[] nums = new int[length];
        int[] tmp = new int[length];
        for (int i = 0; i < length; i++) {
            nums[i] = list.get(i);
            tmp[i] = list.get(i);
        }
        int[] ans = new int[2];

        int cur = 1;
        Arrays.sort(tmp);
        for (int i = 0; i < length; i++) {
            if (tmp[i] != nums[i]) {
                ans[cur] = nums[i];
                //213 123
                cur--;
            }
        }
        return ans;
    }

    private static void InorderTraversal(TreeNode root) {
        if (root == null) {
            return;
        }
        InorderTraversal(root.left);
        list.add(root.val);
        InorderTraversal(root.right);
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int k = scanner.nextInt();
        int[] nums = new int[n];
        for (int i = 0; i < n; i++) {
            nums[i] = scanner.nextInt();
        }
        int tmp = n / k;
        HashMap<Integer, Integer> map = new HashMap<>();
        for (Integer num : nums) {
            if (map.containsKey(num)){
                map.put(num,map.get(num)+1);
            }else {
                map.put(num,1);
            }
        }
        AtomicBoolean flag = new AtomicBoolean(true);
        map.forEach((integer, integer2) -> {
            if (integer2>tmp){
                flag.set(false);
                System.out.print(integer+" ");
            }
        });
        if (flag.get()){
            System.out.println(-1);
        }
    }

    public int maxDistance(int[] arr) {
        // write code here
        Arrays.sort(arr);
        int max = Integer.MIN_VALUE;
        int length = arr.length;
        for (int i = 1; i < length; i++) {
            int difference = arr[i] - arr[i - 1];
            max = Math.max(difference, max);
        }
        return max;
    }
}
